|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectopencard.core.service.CardService
opencard.opt.database.BasicDatabase
This class is designed as a basic default class which allows programmers to access ISO 7816-7-compliant smartcards.
It provides all methods necessary to access database smartcards, as describes in the ISO 7816-7 norm.
It is intended that the CardService developers for specific card use this class as a base class and by inheriting its functionalities
DatabaseCardService| Nested Class Summary |
| Nested classes inherited from class opencard.opt.database.DatabaseCardService |
DatabaseCardService.Constants |
| Field Summary | |
protected int |
MAX_SIZE
MAX_SIZE represents maximum size of a command APDU that can be built. |
| Constructor Summary | |
BasicDatabase()
Constructor called when creating a new BasicDatabase. |
|
| Method Summary | |
void |
begin()
Allocates space for a memory image, e.g. |
void |
commit()
Validates all the modifications made since the transaction operation BEGIN as been executed. The transaction operation BEGIN must have been previously performed. |
void |
createDictionary(java.lang.String dictionary)
Defines a view on the system tables *O, *U and *P. |
void |
createTable(java.lang.String tableName,
java.lang.String columnsList,
byte maxNumberOfRows,
SecurityAttribute securityAttribute)
Defines a table with its columns and possibly with security attributes. |
void |
createTable(java.lang.String tableName,
java.lang.String columnsList,
SecurityAttribute securityAttribute)
|
void |
createUser(java.lang.String userID,
java.lang.String userProfile,
SecurityAttribute securityAttribute)
Initiates the registration of a user. |
void |
createView(java.lang.String viewName,
java.lang.String tableName,
java.lang.String colunmNames,
java.lang.String conditions,
SecurityAttribute securityAttribute)
Defines a view on a table. |
void |
declareCursor(java.lang.String objectName,
java.lang.String columnsName,
java.lang.String conditions)
Cursor is used for pointing to a row on a table, view or dictionary. |
void |
delete()
Deletes a row in a table to which the cursor points. |
void |
deleteUser(java.lang.String userID)
Allows a user to be deleted. |
void |
dropTable(java.lang.String tableName)
Allows to drop a table. A table can only be dropped by its owner. |
void |
dropView(java.lang.String viewName)
Allows to drop a view. A table can only be dropped by its owner. |
java.lang.String[] |
fetch()
Allows to fetch a row or part of it. |
java.lang.String[] |
fetch(byte maxLength)
Allows to fetch a row or part of it. |
java.lang.String[] |
fetchNext()
Used for reading the logical next row from the cursor position. |
java.lang.String[] |
fetchNext(byte maxLength)
Used for reading the logical next row from the cursor position. |
void |
grant(java.lang.String privileges,
java.lang.String objectName,
java.lang.String userID)
Allows to grant privileges to a single user, to a user group or to all users. |
protected void |
initialize(CardServiceScheduler scheduler,
SmartCard smartcard,
boolean blocking)
Allows to initialize the cardservice. |
void |
insert(java.lang.String tableName,
java.lang.String values)
Used to insert a row in a table. |
static boolean |
knows(CardID cid,
CardServiceScheduler sched)
A static method to analyze a smartcard in order to determine if it is an SCQL card, i.e., compliant with the ISO7816-7 standard. |
void |
next()
Sets the current cursor on the next row satisfying the cursor specification. A cursor must have been opened before. |
void |
open()
Opens a cursor, i.e., the cursor is positioned on the first row which satisfies the selection previously defined with the declareCursor method. |
void |
presentUser(java.lang.String userID)
|
void |
presentUser(java.lang.String userID,
SecurityAttribute securityAttribute)
Checks the presented user id. |
void |
revoke(java.lang.String privileges,
java.lang.String objectName,
java.lang.String userID)
Allows to revoke privileges granted before. Only the owner of the table or view can revoke privileges. |
void |
rollback()
Restores the context in the way it was before the transaction operation BEGIN as been executed. The transaction operation BEGIN must have been previously performed. |
protected ResponseAPDU |
sendAPDU(CommandAPDU cmd)
This method is used to send APDU commands to the smartcard. |
protected void |
throwException(ResponseAPDU apdu)
This method is used in this package to manage exceptions. |
void |
update(java.lang.String values)
Updates one or more fields of a row in a table or view to which the cursor points. The command can only be executed by the table owner or a user with the UPDATE privilege. A cursor must be opened before. The value for the special column USER, if present, is inserted by the card. |
| Methods inherited from class opencard.core.service.CardService |
allocateCardChannel, getCard, getCardChannel, getCHVDialog, releaseCardChannel, setCardChannel, setCHVDialog |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface opencard.opt.service.CardServiceInterface |
getCard, setCHVDialog |
| Field Detail |
protected final int MAX_SIZE
| Constructor Detail |
public BasicDatabase()
| Method Detail |
protected void initialize(CardServiceScheduler scheduler,
SmartCard smartcard,
boolean blocking)
throws CardServiceException
initialize in class CardServicescheduler - The CardServiceScheduler.smartcard - The SmartCard.blocking - Boolean that defines if the smartcard blocks
access for other applications while working or not.
CardServiceException - if the service could not be initialized. The object created via the
default constructor may not be used if this happens.BasicDatabase()
public void createTable(java.lang.String tableName,
java.lang.String columnsList,
byte maxNumberOfRows,
SecurityAttribute securityAttribute)
throws SCQLException
A table can only be created by users with the DB_O profile (DataBase Owner) or DBOO (DataBase Object Owner).
createTable in interface DatabaseCardServiceopencard.opt.database.SCQLException#SCQLException()
opencard.opt.database.SCQLException#SCQLException(java.lang.String)
SCQLException(java.lang.String, java.lang.String, java.lang.String, java.lang.String, byte);,
(java.lang.String)
public void createTable(java.lang.String tableName,
java.lang.String columnsList,
SecurityAttribute securityAttribute)
throws SCQLException
SCQLException
public void createView(java.lang.String viewName,
java.lang.String tableName,
java.lang.String colunmNames,
java.lang.String conditions,
SecurityAttribute securityAttribute)
throws SCQLException
createView in interface DatabaseCardServiceconditions - The list of conditions used to build the view.
Each field is separed from the next by a coma.
opencard.opt.database.SCQLException#SCQLException()
opencard.opt.database.SCQLException#SCQLException(java.lang.String)
SCQLException(java.lang.String, java.lang.String, byte, byte),
(java.lang.String)
public void createDictionary(java.lang.String dictionary)
throws SCQLException
createDictionary in interface DatabaseCardServicedictionary - The name of the dictionary you want to create.
opencard.opt.database.SCQLException#SCQLException()
opencard.opt.database.SCQLException#SCQLException(java.lang.String)
SCQLExceptionopencard.opt.database.BasicDatabase#createTable(java.lang.String, java.lang.String ,byte, byte),
(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
public void dropTable(java.lang.String tableName)
throws SCQLException
dropTable in interface DatabaseCardServiceopencard.opt.database.SCQLException#SCQLException()
opencard.opt.database.SCQLException#SCQLException(java.lang.String)
SCQLException(java.lang.String)
public void dropView(java.lang.String viewName)
throws SCQLException
dropView in interface DatabaseCardServiceopencard.opt.database.SCQLException#SCQLException()
opencard.opt.database.SCQLException#SCQLException(java.lang.String)
SCQLException(java.lang.String)
public void grant(java.lang.String privileges,
java.lang.String objectName,
java.lang.String userID)
throws SCQLException
The following rivileges may be granted.
Privileges for table access :
grant in interface DatabaseCardServiceopencard.opt.database.SCQLException#SCQLException()
opencard.opt.database.SCQLException#SCQLException(java.lang.String)
SCQLException(java.lang.String, java.lang.String, java.lang.String),
SecurityStatusNotSatisfiedException,
IncorrectParameterInDataFieldException,
OperationNotSupportedException,
ReferencedObjectNotFoundException
public void revoke(java.lang.String privileges,
java.lang.String objectName,
java.lang.String userID)
throws SCQLException
revoke in interface DatabaseCardServiceopencard.opt.database.SCQLException#SCQLException()
opencard.opt.database.SCQLException#SCQLException(java.lang.String)
SCQLException(java.lang.String, java.lang.String, java.lang.String),
SecurityStatusNotSatisfiedException,
IncorrectParameterInDataFieldException,
ReferencedObjectNotFoundException
public void declareCursor(java.lang.String objectName,
java.lang.String columnsName,
java.lang.String conditions)
throws SCQLException
declareCursor in interface DatabaseCardServiceSCQLExceptionfetch(),
fetch(byte),
fetchNext(),
fetchNext(byte),
open(),
next()
public void open()
throws SCQLException
declareCursor method.
open in interface DatabaseCardServiceSCQLExceptionfetch(),
fetch(byte),
fetchNext(),
fetchNext(byte),
declareCursor(java.lang.String, java.lang.String, java.lang.String),
next()
public void next()
throws SCQLException
next in interface DatabaseCardServiceSCQLExceptionfetch(),
fetch(byte),
fetchNext(),
fetchNext(byte),
declareCursor(java.lang.String, java.lang.String, java.lang.String),
open()
public java.lang.String[] fetch(byte maxLength)
throws SCQLException
fetch in interface DatabaseCardServiceSCQLExceptionfetch(),
fetchNext(),
fetchNext(byte),
declareCursor(java.lang.String, java.lang.String, java.lang.String),
open(),
opencard.opt.database.BasicDatabase#next(byte)
public java.lang.String[] fetch()
throws SCQLException
fetch in interface DatabaseCardServiceSCQLExceptionfetch(byte),
fetchNext(),
fetchNext(byte),
declareCursor(java.lang.String, java.lang.String, java.lang.String),
open(),
opencard.opt.database.BasicDatabase#next(byte)
public java.lang.String[] fetchNext(byte maxLength)
throws SCQLException
fetchNext in interface DatabaseCardServiceSCQLExceptionfetch(byte),
fetch(),
fetchNext(),
declareCursor(java.lang.String, java.lang.String, java.lang.String),
open(),
opencard.opt.database.BasicDatabase#next(byte)
public java.lang.String[] fetchNext()
throws SCQLException
fetchNext in interface DatabaseCardServiceSCQLExceptionfetch(byte),
fetch(),
fetchNext(byte),
declareCursor(java.lang.String, java.lang.String, java.lang.String),
open(),
opencard.opt.database.BasicDatabase#next(byte)
public void insert(java.lang.String tableName,
java.lang.String values)
throws SCQLException
insert in interface DatabaseCardServicevalues - The String that contains the list of values to be
inserted.
SCQLExceptionupdate(java.lang.String),
delete()
public void update(java.lang.String values)
throws SCQLException
update in interface DatabaseCardServicevalues - The String that contains the list of values to be updated.
SCQLExceptioninsert(java.lang.String, java.lang.String),
delete()
public void delete()
throws SCQLException
delete in interface DatabaseCardServiceSCQLExceptioninsert(java.lang.String, java.lang.String),
update(java.lang.String)
public void begin()
throws SCQLException
begin in interface DatabaseCardServiceSCQLExceptioncommit(),
rollback()
public void commit()
throws SCQLException
commit in interface DatabaseCardServiceSCQLExceptionbegin(),
rollback()
public void rollback()
throws SCQLException
rollback in interface DatabaseCardServiceSCQLExceptionbegin(),
commit()
public void presentUser(java.lang.String userID,
SecurityAttribute securityAttribute)
throws SCQLException
presentUser in interface DatabaseCardServicesecurityAttribute - the security attribute presented
for authentication.
SCQLExceptionopencard.opt.database.BasicDatabase#createUser(java.lang.String, java.lang.String, java.lang.String),
deleteUser(java.lang.String),
SecurityAttribute
public void presentUser(java.lang.String userID)
throws SCQLException
presentUser in interface DatabaseCardServiceSCQLException
public void createUser(java.lang.String userID,
java.lang.String userProfile,
SecurityAttribute securityAttribute)
throws SCQLException
createUser in interface DatabaseCardServicesecurityAttribute - the security attribute presented
for authentication.
SCQLExceptionopencard.opt.database.BasicDatabase#presentUser(java.lang.String, java.lang.String),
deleteUser(java.lang.String)
public void deleteUser(java.lang.String userID)
throws SCQLException
deleteUser in interface DatabaseCardServiceSCQLExceptionopencard.opt.database.BasicDatabase#presentUser(java.lang.String, java.lang.String),
opencard.opt.database.BasicDatabase#createUser(java.lang.String, java.lang.String, java.lang.String)
protected void throwException(ResponseAPDU apdu)
throws SCQLException
SCQLException
protected ResponseAPDU sendAPDU(CommandAPDU cmd)
throws SCQLException
cmd - The APDU command to be sent.
SCQLException
public static boolean knows(CardID cid,
CardServiceScheduler sched)
cid - the ATR of the smartcardsched - a CardServiceScheduler for temporary communication
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||